home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectSound / AdjustSound / frmAdjust.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-10-08  |  23.3 KB  |  696 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  4. Begin VB.Form frmAdjust 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "Adjust Sound"
  7.    ClientHeight    =   6420
  8.    ClientLeft      =   240
  9.    ClientTop       =   525
  10.    ClientWidth     =   6900
  11.    Icon            =   "frmAdjust.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   6420
  15.    ScaleWidth      =   6900
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.Timer tmrUpdate 
  18.       Interval        =   250
  19.       Left            =   7200
  20.       Top             =   240
  21.    End
  22.    Begin MSComctlLib.Slider sldFreq 
  23.       Height          =   270
  24.       Left            =   2460
  25.       TabIndex        =   17
  26.       Top             =   960
  27.       Width           =   3615
  28.       _ExtentX        =   6376
  29.       _ExtentY        =   476
  30.       _Version        =   393216
  31.       LargeChange     =   1000
  32.       SmallChange     =   100
  33.       Min             =   100
  34.       Max             =   100000
  35.       SelStart        =   100
  36.       TickFrequency   =   10000
  37.       Value           =   100
  38.    End
  39.    Begin MSComDlg.CommonDialog cdlFile 
  40.       Left            =   8880
  41.       Top             =   240
  42.       _ExtentX        =   847
  43.       _ExtentY        =   847
  44.       _Version        =   393216
  45.    End
  46.    Begin VB.CommandButton cmdExit 
  47.       Caption         =   "Exit"
  48.       Height          =   315
  49.       Left            =   5760
  50.       TabIndex        =   12
  51.       Top             =   6060
  52.       Width           =   975
  53.    End
  54.    Begin VB.CommandButton cmdStop 
  55.       Caption         =   "Stop"
  56.       Enabled         =   0   'False
  57.       Height          =   315
  58.       Left            =   1080
  59.       TabIndex        =   11
  60.       Top             =   6060
  61.       Width           =   975
  62.    End
  63.    Begin VB.CommandButton cmdPlay 
  64.       Caption         =   "Play"
  65.       Enabled         =   0   'False
  66.       Height          =   315
  67.       Left            =   60
  68.       TabIndex        =   10
  69.       Top             =   6060
  70.       Width           =   975
  71.    End
  72.    Begin VB.CommandButton cmdSound 
  73.       Caption         =   "Sound &File"
  74.       Default         =   -1  'True
  75.       Height          =   315
  76.       Left            =   120
  77.       TabIndex        =   9
  78.       Top             =   120
  79.       Width           =   975
  80.    End
  81.    Begin VB.CheckBox chkLoop 
  82.       Caption         =   "Loop Sound"
  83.       Height          =   315
  84.       Left            =   120
  85.       TabIndex        =   8
  86.       Top             =   5580
  87.       Width           =   3135
  88.    End
  89.    Begin VB.Frame Frame1 
  90.       Caption         =   "Expected Behavior"
  91.       Height          =   2475
  92.       Index           =   1
  93.       Left            =   120
  94.       TabIndex        =   7
  95.       Top             =   3060
  96.       Width           =   6615
  97.       Begin VB.Label lblBehavior 
  98.          BackStyle       =   0  'Transparent
  99.          Caption         =   "Expected Behavior Text"
  100.          Height          =   2055
  101.          Left            =   120
  102.          TabIndex        =   13
  103.          Top             =   300
  104.          Width           =   6375
  105.       End
  106.    End
  107.    Begin VB.Frame Frame1 
  108.       Caption         =   "Buffer Settings"
  109.       Height          =   915
  110.       Index           =   0
  111.       Left            =   120
  112.       TabIndex        =   6
  113.       Top             =   2040
  114.       Width           =   6615
  115.       Begin VB.PictureBox Picture1 
  116.          BorderStyle     =   0  'None
  117.          Height          =   255
  118.          Index           =   1
  119.          Left            =   1260
  120.          ScaleHeight     =   255
  121.          ScaleWidth      =   5235
  122.          TabIndex        =   32
  123.          Top             =   540
  124.          Width           =   5235
  125.          Begin VB.OptionButton optDefault 
  126.             Caption         =   "Default"
  127.             Height          =   195
  128.             Left            =   0
  129.             TabIndex        =   35
  130.             Top             =   0
  131.             Value           =   -1  'True
  132.             Width           =   1035
  133.          End
  134.          Begin VB.OptionButton optHardware 
  135.             Caption         =   "Hardware"
  136.             Height          =   195
  137.             Left            =   1200
  138.             TabIndex        =   34
  139.             Top             =   0
  140.             Width           =   1035
  141.          End
  142.          Begin VB.OptionButton optSoftware 
  143.             Caption         =   "Software"
  144.             Height          =   195
  145.             Left            =   2400
  146.             TabIndex        =   33
  147.             Top             =   0
  148.             Width           =   1035
  149.          End
  150.       End
  151.       Begin VB.PictureBox Picture1 
  152.          BorderStyle     =   0  'None
  153.          Height          =   255
  154.          Index           =   0
  155.          Left            =   1260
  156.          ScaleHeight     =   255
  157.          ScaleWidth      =   5235
  158.          TabIndex        =   28
  159.          Top             =   180
  160.          Width           =   5235
  161.          Begin VB.OptionButton optGlobal 
  162.             Caption         =   "Global"
  163.             Height          =   195
  164.             Left            =   2400
  165.             TabIndex        =   31
  166.             Top             =   0
  167.             Width           =   1035
  168.          End
  169.          Begin VB.OptionButton optSticky 
  170.             Caption         =   "Sticky"
  171.             Height          =   195
  172.             Left            =   1200
  173.             TabIndex        =   30
  174.             Top             =   0
  175.             Width           =   1035
  176.          End
  177.          Begin VB.OptionButton optNormal 
  178.             Caption         =   "Normal"
  179.             Height          =   195
  180.             Left            =   0
  181.             TabIndex        =   29
  182.             Top             =   0
  183.             Value           =   -1  'True
  184.             Width           =   1035
  185.          End
  186.       End
  187.       Begin VB.Label Label1 
  188.          BackStyle       =   0  'Transparent
  189.          Caption         =   "Buffer Mixing"
  190.          Height          =   195
  191.          Index           =   11
  192.          Left            =   120
  193.          TabIndex        =   27
  194.          Top             =   540
  195.          Width           =   915
  196.       End
  197.       Begin VB.Label Label1 
  198.          BackStyle       =   0  'Transparent
  199.          Caption         =   "Focus"
  200.          Height          =   195
  201.          Index           =   10
  202.          Left            =   120
  203.          TabIndex        =   26
  204.          Top             =   240
  205.          Width           =   555
  206.       End
  207.    End
  208.    Begin MSComctlLib.Slider sldPan 
  209.       Height          =   270
  210.       Left            =   2460
  211.       TabIndex        =   24
  212.       Top             =   1320
  213.       Width           =   3615
  214.       _ExtentX        =   6376
  215.       _ExtentY        =   476
  216.       _Version        =   393216
  217.       LargeChange     =   1000
  218.       SmallChange     =   100
  219.       Min             =   -10000
  220.       Max             =   10000
  221.       TickFrequency   =   1000
  222.    End
  223.    Begin MSComctlLib.Slider sldVolume 
  224.       Height          =   270
  225.       Left            =   2460
  226.       TabIndex        =   25
  227.       Top             =   1680
  228.       Width           =   3615
  229.       _ExtentX        =   6376
  230.       _ExtentY        =   476
  231.       _Version        =   393216
  232.       LargeChange     =   1000
  233.       SmallChange     =   100
  234.       Min             =   -2500
  235.       Max             =   0
  236.       TickFrequency   =   250
  237.    End
  238.    Begin VB.Label Label1 
  239.       Alignment       =   2  'Center
  240.       BackStyle       =   0  'Transparent
  241.       Caption         =   "High"
  242.       Height          =   195
  243.       Index           =   9
  244.       Left            =   6240
  245.       TabIndex        =   23
  246.       Top             =   1740
  247.       Width           =   555
  248.    End
  249.    Begin VB.Label Label1 
  250.       Alignment       =   2  'Center
  251.       BackStyle       =   0  'Transparent
  252.       Caption         =   "Low"
  253.       Height          =   195
  254.       Index           =   8
  255.       Left            =   1860
  256.       TabIndex        =   22
  257.       Top             =   1740
  258.       Width           =   555
  259.    End
  260.    Begin VB.Label Label1 
  261.       Alignment       =   2  'Center
  262.       BackStyle       =   0  'Transparent
  263.       Caption         =   "Right"
  264.       Height          =   195
  265.       Index           =   7
  266.       Left            =   6180
  267.       TabIndex        =   21
  268.       Top             =   1380
  269.       Width           =   555
  270.    End
  271.    Begin VB.Label Label1 
  272.       Alignment       =   2  'Center
  273.       BackStyle       =   0  'Transparent
  274.       Caption         =   "Left"
  275.       Height          =   195
  276.       Index           =   6
  277.       Left            =   1860
  278.       TabIndex        =   20
  279.       Top             =   1380
  280.       Width           =   555
  281.    End
  282.    Begin VB.Label Label1 
  283.       BackStyle       =   0  'Transparent
  284.       Caption         =   "100 KHz"
  285.       Height          =   195
  286.       Index           =   5
  287.       Left            =   6120
  288.       TabIndex        =   19
  289.       Top             =   1020
  290.       Width           =   615
  291.    End
  292.    Begin VB.Label Label1 
  293.       BackStyle       =   0  'Transparent
  294.       Caption         =   "100 Hz"
  295.       Height          =   195
  296.       Index           =   4
  297.       Left            =   1860
  298.       TabIndex        =   18
  299.       Top             =   1020
  300.       Width           =   555
  301.    End
  302.    Begin VB.Label lblVolume 
  303.       BackStyle       =   0  'Transparent
  304.       BorderStyle     =   1  'Fixed Single
  305.       Height          =   315
  306.       Left            =   1200
  307.       TabIndex        =   16
  308.       Top             =   1680
  309.       Width           =   555
  310.    End
  311.    Begin VB.Label lblPan 
  312.       BackStyle       =   0  'Transparent
  313.       BorderStyle     =   1  'Fixed Single
  314.       Height          =   315
  315.       Left            =   1200
  316.       TabIndex        =   15
  317.       Top             =   1320
  318.       Width           =   555
  319.    End
  320.    Begin VB.Label lblFrequency 
  321.       BackStyle       =   0  'Transparent
  322.       BorderStyle     =   1  'Fixed Single
  323.       Height          =   315
  324.       Left            =   1200
  325.       TabIndex        =   14
  326.       Top             =   960
  327.       Width           =   555
  328.    End
  329.    Begin VB.Label lblStatus 
  330.       BackStyle       =   0  'Transparent
  331.       BorderStyle     =   1  'Fixed Single
  332.       Height          =   315
  333.       Left            =   1200
  334.       TabIndex        =   5
  335.       Top             =   540
  336.       Width           =   5475
  337.    End
  338.    Begin VB.Label lblFile 
  339.       BackStyle       =   0  'Transparent
  340.       BorderStyle     =   1  'Fixed Single
  341.       Height          =   315
  342.       Left            =   1200
  343.       TabIndex        =   4
  344.       Top             =   120
  345.       Width           =   5475
  346.    End
  347.    Begin VB.Label Label1 
  348.       BackStyle       =   0  'Transparent
  349.       Caption         =   "Volume"
  350.       Height          =   195
  351.       Index           =   3
  352.       Left            =   180
  353.       TabIndex        =   3
  354.       Top             =   1740
  355.       Width           =   795
  356.    End
  357.    Begin VB.Label Label1 
  358.       BackStyle       =   0  'Transparent
  359.       Caption         =   "Pan"
  360.       Height          =   195
  361.       Index           =   2
  362.       Left            =   180
  363.       TabIndex        =   2
  364.       Top             =   1380
  365.       Width           =   795
  366.    End
  367.    Begin VB.Label Label1 
  368.       BackStyle       =   0  'Transparent
  369.       Caption         =   "Frequency"
  370.       Height          =   195
  371.       Index           =   1
  372.       Left            =   180
  373.       TabIndex        =   1
  374.       Top             =   1020
  375.       Width           =   795
  376.    End
  377.    Begin VB.Label Label1 
  378.       BackStyle       =   0  'Transparent
  379.       Caption         =   "Status"
  380.       Height          =   195
  381.       Index           =   0
  382.       Left            =   180
  383.       TabIndex        =   0
  384.       Top             =   600
  385.       Width           =   795
  386.    End
  387. Attribute VB_Name = "frmAdjust"
  388. Attribute VB_GlobalNameSpace = False
  389. Attribute VB_Creatable = False
  390. Attribute VB_PredeclaredId = True
  391. Attribute VB_Exposed = False
  392. Option Explicit
  393. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  394. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  395. '  File:       frmAdjust.frm
  396. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  397. 'API declare for windows folder
  398. Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
  399. Private dx As New DirectX8
  400. Private ds As DirectSound8
  401. Private dsb As DirectSoundSecondaryBuffer8
  402. Private msFile As String
  403. Private Sub cmdExit_Click()
  404.     Cleanup
  405.     Unload Me
  406. End Sub
  407. Private Sub Cleanup()
  408.     If Not (dsb Is Nothing) Then dsb.Stop
  409.     Set dsb = Nothing
  410.     Set ds = Nothing
  411.     Set dx = Nothing
  412. End Sub
  413. Private Function InitDSound() As Boolean
  414.     On Error GoTo FailedInit
  415.     InitDSound = True
  416.     Set ds = dx.DirectSoundCreate(vbNullString)
  417.     ds.SetCooperativeLevel Me.hWnd, DSSCL_PRIORITY
  418.     Exit Function
  419. FailedInit:
  420.     InitDSound = False
  421. End Function
  422. Private Sub cmdPlay_Click()
  423.     Dim dsBuf As DSBUFFERDESC
  424.     Dim bFocusSticky As Boolean, bFocusGlobal As Boolean
  425.     Dim bMixHardware As Boolean, bMixSoftware As Boolean
  426.     On Error GoTo ErrOut
  427.     bFocusSticky = (optSticky.Value)
  428.     bFocusGlobal = (optGlobal.Value)
  429.     bMixHardware = (optHardware.Value)
  430.     bMixSoftware = (optSoftware.Value)
  431.         
  432.     dsBuf.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME
  433.     If bFocusGlobal Then
  434.         dsBuf.lFlags = dsBuf.lFlags Or DSBCAPS_GLOBALFOCUS
  435.     End If
  436.     If bFocusSticky Then
  437.         dsBuf.lFlags = dsBuf.lFlags Or DSBCAPS_STICKYFOCUS
  438.     End If
  439.     If bMixHardware Then
  440.         dsBuf.lFlags = dsBuf.lFlags Or DSBCAPS_LOCHARDWARE
  441.     End If
  442.     If bMixSoftware Then
  443.         dsBuf.lFlags = dsBuf.lFlags Or DSBCAPS_LOCSOFTWARE
  444.     End If
  445.             
  446.     Set dsb = ds.CreateSoundBufferFromFile(msFile, dsBuf)
  447.     'Update the buffer based on the current slider
  448.     OnSliderChange
  449.     If chkLoop.Value = vbChecked Then
  450.         dsb.Play DSBPLAY_LOOPING
  451.     Else
  452.         dsb.Play 0
  453.     End If
  454.     lblStatus.Caption = "File playing."
  455.     EnablePlayUI False
  456.     Exit Sub
  457. ErrOut:
  458.     lblStatus.Caption = "An error occured trying to play this file with these settings."
  459. End Sub
  460. Private Sub cmdSound_Click()
  461.     Static sCurDir As String
  462.     Static lFilter As Long
  463.     Dim dsBuf As DSBUFFERDESC
  464.     'Now we should load a wave file
  465.     'Ask them for a file to load
  466.     UpdateStatus "Loading file..."
  467.     With cdlFile
  468.         .flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly
  469.         .FilterIndex = lFilter
  470.         .Filter = "Wave Files (*.wav)|*.wav"
  471.         .FileName = vbNullString
  472.         If sCurDir = vbNullString Then
  473.             'Set the init folder to \windows\media if it exists.  If not, set it to the \windows folder
  474.             Dim sWindir As String
  475.             sWindir = Space$(255)
  476.             If GetWindowsDirectory(sWindir, 255) = 0 Then
  477.                 'We couldn't get the windows folder for some reason, use the c:\
  478.                 .InitDir = "C:\"
  479.             Else
  480.                 Dim sMedia As String
  481.                 sWindir = Left$(sWindir, InStr(sWindir, Chr$(0)) - 1)
  482.                 If Right$(sWindir, 1) = "\" Then
  483.                     sMedia = sWindir & "Media"
  484.                 Else
  485.                     sMedia = sWindir & "\Media"
  486.                 End If
  487.                 If Dir$(sMedia, vbDirectory) <> vbNullString Then
  488.                     .InitDir = sMedia
  489.                 Else
  490.                     .InitDir = sWindir
  491.                 End If
  492.             End If
  493.         Else
  494.             .InitDir = sCurDir
  495.         End If
  496.         .ShowOpen   ' Display the Open dialog box
  497.         If .FileName = vbNullString Then
  498.             UpdateStatus "No file loaded."
  499.             Exit Sub 'We didn't click anything exit
  500.         End If
  501.         'Save the current information
  502.         sCurDir = GetFolder(.FileName)
  503.         lFilter = .FilterIndex
  504.         UpdateStatus "File loaded."
  505.         
  506.         'Save the filename for later use
  507.         msFile = .FileName
  508.         If Not (dsb Is Nothing) Then dsb.Stop
  509.         Set dsb = Nothing
  510.         dsBuf.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME
  511.         On Error Resume Next
  512.         Set dsb = ds.CreateSoundBufferFromFile(msFile, dsBuf)
  513.         If Err Then
  514.             UpdateStatus "Could not create buffer."
  515.             Exit Sub
  516.         End If
  517.         sldFreq.Value = dsBuf.fxFormat.lSamplesPerSec
  518.         lblFile.Caption = .FileName
  519.         EnablePlayUI True
  520.     End With
  521. End Sub
  522. Private Sub cmdStop_Click()
  523.     If Not (dsb Is Nothing) Then
  524.         dsb.Stop 'Stop the buffer and reset it's position
  525.         dsb.SetCurrentPosition 0
  526.         lblStatus.Caption = "File stopped."
  527.         EnablePlayUI True
  528.     End If
  529. End Sub
  530. Private Sub Form_Load()
  531.     'First we should set up our DirectSound object
  532.     If Not InitDSound Then
  533.         MsgBox "Could not initialize DirectSound.  This sample is exiting.", vbOKOnly Or vbInformation, "Failed."
  534.         Cleanup
  535.         Unload Me
  536.         End
  537.     End If
  538.     UpdateBehaviorText
  539.     OnSliderChange
  540.     UpdateStatus "No file loaded."
  541. End Sub
  542. Private Sub UpdateBehaviorText()
  543.     Dim sText As String
  544.     Dim bFocusSticky As Boolean, bFocusGlobal As Boolean
  545.     Dim bMixHardware As Boolean, bMixSoftware As Boolean
  546.     bFocusSticky = (optSticky.Value)
  547.     bFocusGlobal = (optGlobal.Value)
  548.     bMixHardware = (optHardware.Value)
  549.     bMixSoftware = (optSoftware.Value)
  550.     'Figure what the user should expect based on the dialog choice
  551.     If bFocusSticky Then
  552.         sText = "With sticky focus an application using DirectSound " & _
  553.                              "can continue to play its sticky focus buffers if the " & _
  554.                              "user switches to another application not using " & _
  555.                              "DirectSound.  However, if the user switches to another " & _
  556.                              "DirectSound application, all sound buffers, both normal " & _
  557.                              "and sticky focus, in the previous application are muted."
  558.     ElseIf bFocusGlobal Then
  559.         sText = "With global focus, an application using DirectSound " & _
  560.                              "can continue to play its buffers if the user switches " & _
  561.                              "focus to another application, even if the new application " & _
  562.                              "uses DirectSound. The one exception is if you switch " & _
  563.                              "focus to a DirectSound application that uses the " & _
  564.                              "DSSCL_WRITEPRIMARY flag for its " & _
  565.                              "cooperative level. In this case, the global sounds from " & _
  566.                              "other applications will not be audible."
  567.     Else
  568.         'Normal focus
  569.         sText = "With normal focus, an application using DirectSound " & _
  570.                              "will mute its buffers if the user switches focus to " & _
  571.                              "another application"
  572.     End If
  573.     If bMixHardware Then
  574.         sText = sText & vbCrLf & vbCrLf & "With hardware mixing, the new buffer will be " & _
  575.                              "forced to use hardware mixing. If the device does " & _
  576.                              "not support hardware mixing or if the required " & _
  577.                              "hardware memory is not available, the call to the " & _
  578.                              "IDirectSound::CreateSoundBuffer method will fail."
  579.     ElseIf bMixSoftware Then
  580.         sText = sText & vbCrLf & vbCrLf & "With software mixing, the new buffer will be " & _
  581.                              "stored in software memory and use software mixing, " & _
  582.                              "even if hardware resources are available."
  583.     Else
  584.         'Default mixing
  585.         sText = sText & vbCrLf & vbCrLf & "With default mixing, the new buffer will use " & _
  586.                              "hardware mixing if availible, otherwise software " & _
  587.                              "memory and mixing will be used."
  588.     End If
  589.     'Tell the user what to expect
  590.     lblBehavior.Caption = sText
  591. End Sub
  592. Private Sub optDefault_Click()
  593.     UpdateBehaviorText
  594. End Sub
  595. Private Sub optGlobal_Click()
  596.     UpdateBehaviorText
  597. End Sub
  598. Private Sub optHardware_Click()
  599.     UpdateBehaviorText
  600. End Sub
  601. Private Sub optNormal_Click()
  602.     UpdateBehaviorText
  603. End Sub
  604. Private Sub optSoftware_Click()
  605.     UpdateBehaviorText
  606. End Sub
  607. Private Sub optSticky_Click()
  608.     UpdateBehaviorText
  609. End Sub
  610. Private Function GetFolder(ByVal sFile As String) As String
  611.     Dim lCount As Long
  612.     For lCount = Len(sFile) To 1 Step -1
  613.         If Mid$(sFile, lCount, 1) = "\" Then
  614.             GetFolder = Left$(sFile, lCount)
  615.             Exit Function
  616.         End If
  617.     Next
  618.     GetFolder = vbNullString
  619. End Function
  620. Private Sub OnSliderChange()
  621.     Dim lFrequency As Long, lPan As Long, lVolume As Long
  622.     'Get the position of the sliders
  623.     lFrequency = sldFreq.Value
  624.     lPan = sldPan.Value
  625.     lVolume = sldVolume.Value
  626.     'Set the static labels
  627.     lblFrequency.Caption = CStr(lFrequency)
  628.     lblPan.Caption = CStr(lPan)
  629.     lblVolume.Caption = CStr(lVolume)
  630.     'Set the options in the DirectSound buffer
  631.     If Not (dsb Is Nothing) Then
  632.         dsb.SetFrequency lFrequency
  633.         dsb.SetPan lPan
  634.         dsb.SetVolume lVolume
  635.     End If
  636. End Sub
  637. Private Sub sldFreq_Change()
  638.     OnSliderChange
  639. End Sub
  640. Private Sub sldFreq_Scroll()
  641.     OnSliderChange
  642. End Sub
  643. Private Sub sldPan_Change()
  644.     OnSliderChange
  645. End Sub
  646. Private Sub sldPan_Scroll()
  647.     OnSliderChange
  648. End Sub
  649. Private Sub sldVolume_Change()
  650.     OnSliderChange
  651. End Sub
  652. Private Sub UpdateStatus(ByVal sStatus As String)
  653.     lblStatus.Caption = sStatus
  654. End Sub
  655. Private Sub sldVolume_Scroll()
  656.     OnSliderChange
  657. End Sub
  658. Private Sub tmrUpdate_Timer()
  659.     If Not (dsb Is Nothing) Then
  660.         If (dsb.GetStatus And DSBSTATUS_PLAYING) <> DSBSTATUS_PLAYING Then
  661.             If cmdPlay.Enabled = False Then
  662.                 EnablePlayUI True
  663.                 lblStatus.Caption = "File stopped."
  664.             End If
  665.         End If
  666.     End If
  667. End Sub
  668. Private Sub EnablePlayUI(ByVal fEnable As Boolean)
  669.     On Error Resume Next
  670.     If fEnable Then
  671.         chkLoop.Enabled = True
  672.         cmdPlay.Enabled = True
  673.         cmdStop.Enabled = False
  674.         optNormal.Enabled = True
  675.         optSticky.Enabled = True
  676.         optGlobal.Enabled = True
  677.         optDefault.Enabled = True
  678.         optHardware.Enabled = True
  679.         optSoftware.Enabled = True
  680.         cmdSound.Enabled = True
  681.         cmdPlay.SetFocus
  682.     Else
  683.         chkLoop.Enabled = False
  684.         cmdPlay.Enabled = False
  685.         cmdStop.Enabled = True
  686.         optNormal.Enabled = False
  687.         optSticky.Enabled = False
  688.         optGlobal.Enabled = False
  689.         optDefault.Enabled = False
  690.         optHardware.Enabled = False
  691.         optSoftware.Enabled = False
  692.         cmdSound.Enabled = False
  693.         cmdStop.SetFocus
  694.     End If
  695. End Sub
  696.